<?php
	if($_SERVER['HTTPS']!="on")
	{
		$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
		header("Location:$redirect");
	}
	
	require_once(dirname(__FILE__)) . "/config/cConfig.php";
	
	$webConfig = new \ampleharvest\cConfig();
	
	$type = '';
	if(array_key_exists('type', $_REQUEST)) {
		$type = $_REQUEST['type'];
	}
	$ID = '';
	if(isset($_REQUEST['id'])) {
		$ID = $_REQUEST['id'];
	}
	$view = '';
	if(isset($_REQUEST['view'])) {
		$view = $_REQUEST['view'];
	}
	
	$apache_user = apache_getenv('SSL_CLIENT_S_DN');
?>
<html>
	<head>
		<title><?php print($webConfig->C_STR_TITLE)?></title>	
	</head>
	<body>

	<?php require('ext-setup.php')?>
	
	<script language="javascript">

			if(typeof Ext === 'object')
			{
				Ext.onReady(Setup);
				
				function Setup()
				{
					
					var dn = '<?php print($apache_user)?>';

					console.log('This is your DN:'+dn);
					obj_config = new Object();
					obj_config.user = new Object();
					obj_config.user.dn = dn;
					
					m_obj_Status_ViewPort = Ext.create('AmpleHarvest.views.system.main', 
							{
								str_dn			: dn,
					    		renderTo		: Ext.getBody()
					    	});
					
				}
			}
			else
			{
				console.log('no');
			}

			
		</script>
	</body>
</html>
